namespace XRM.Security.DataAccess.Context
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddUserRegisterColumn1 : DbMigration
    {
        public override void Up()
        {
            Sql("delete from CertRegister");
            Sql("delete from UserPC");
            Sql("delete from UserRegister");

            AddColumn("dbo.UserRegister", "Post", c => c.String(maxLength: 500));
            AddColumn("dbo.UserRegister", "DepartmentAddressId", c => c.Int(nullable: false));
            CreateIndex("dbo.UserRegister", "DepartmentAddressId");
            AddForeignKey("dbo.UserRegister", "DepartmentAddressId", "dbo.DepartmentAddress", "DepartmentAddressId");
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.UserRegister", "DepartmentAddressId", "dbo.DepartmentAddress");
            DropIndex("dbo.UserRegister", new[] { "DepartmentAddressId" });
            DropColumn("dbo.UserRegister", "DepartmentAddressId");
            DropColumn("dbo.UserRegister", "Post");
        }
    }
}
